package cn.csdj.sism.service.impl;

import cn.csdj.sism.dao.PaymentMapper;
import cn.csdj.sism.pojo.Consultant;
import cn.csdj.sism.pojo.Payment;
import cn.csdj.sism.pojo.Student;
import cn.csdj.sism.service.ConsultantService;
import cn.csdj.sism.service.PaymentService;
import cn.csdj.sism.service.StudentService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.util.List;
/**
 * @author 李加
 * 2023/4/10
 */
@Service
@Transactional
public class PaymentServiceImpl implements PaymentService {
    @Autowired
    private PaymentMapper paymentMapper;
    @Autowired
    private StudentService studentService;
    @Autowired
    private ConsultantService consultantService;
    @Override
    public List<Payment> selectPmAll() {
        return paymentMapper.selectList(null);
    }

    @Override
    public Payment selectPmById(Integer id) {
        return paymentMapper.selectById(id);
    }

    @Override
    public int insertPm(Payment payment) {
        return paymentMapper.insert(payment);
    }

    @Override
    public int updatePm(Payment payment) {
        return paymentMapper.updateById(payment);
    }

    @Override
    public int delectPmById(Integer id) {
        return paymentMapper.deleteById(id);
    }

    @Override
    public IPage<Payment> selectPage(Integer current, Integer pageSize) {
        IPage<Payment> page=new Page<>(current,pageSize);
        paymentMapper.selectPage(page,null);
        return page;
    }
}
